/**
 * 内容组件
 * */

import React from "react";
import { Switch, Redirect, Route } from "react-router-dom";

import AppHeader from "../../components/AppHeader";
import AppFooter from "../../components/AppFooter";

// 后勤保卫处
import LogisticsSecurity from "../logisticsSecurity";


import "./index.less";

const list = [
  { path: "/logisticsSecurity", element: LogisticsSecurity, title: "后勤保卫处" }, 
];

const Main = () => {
  const path = list[0]?.path || "/404";

  return (
    <div className="main-container">
      <AppHeader />
      <Switch>
        {/*  只匹配其中一个  */}
        <Redirect exact from="/" to={path} />
        {list.map((item, index) => (
          <Route
            exact
            key={index}
            path={item.path}
            render={(props) => (
              <item.element
                title={item.title}
                {...props}
              />
            )}
          />
        ))}
      </Switch>
      <AppFooter />
    </div>
  );
};

export default Main;
